package org.dtrd.modules.service.entity.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dtrd.config.pay.OrderUtil;

/**
 * @author xiao
 * @date 2022/6/20 8:23 PM
 */
@ApiModel(value = "服务包规格")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PackageSpecs {

    @ApiModelProperty(value = "规格名称")
    private String name;

    @ApiModelProperty(value = "价格,单位：分")
    private Integer price;

    @ApiModelProperty(value = "价格,单位：元")
    private String priceStr;

    public PackageSpecs(String name, Integer price) {
        this.name = name;
        setPrice(price);
    }

    public void setPrice(Integer price) {
        this.price = price;
        priceStr = price == null ? "" : OrderUtil.changeF2Y(Long.valueOf(price));
    }
}
